package com.ruoyi.jjm.domain;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.utils.DateUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 村民购煤订单对象 t_client_user_order
 * 
 * @author tsr
 * @date 2020-07-15
 */
public class ClientUserOrderTable implements Serializable
{
    private static final long serialVersionUID = 1L;

    /** null */
    @ExcelIgnore
    private Long id;


    /** 户主 */
    @ExcelProperty(value = "户主姓名")
    @Excel(name = "户主姓名")
    private String masterName;

    /** 户主电话 */
    @ExcelProperty(value = "手机号")
    @Excel(name = "手机号")
    private String masterPhoneNumber;

    /** 身份证号 */
    @ExcelProperty(value = "身份证号")
    @Excel(name = "身份证号")
    private String masterIdentityCardNumber;

    /** 订单数量（吨） */
    @ExcelProperty(value = "购煤数量")
    @Excel(name = "购煤数量")
    private String amount;

    /** 金额 */
    @ExcelProperty(value = "购煤款")
    @Excel(name = "购煤款")
    private String money;

    @ExcelProperty(value = "购煤时间")
    @Excel(name = "购煤时间")
    @DateTimeFormat("yyyy.mm.dd")
    private String createTime;

    @ExcelProperty(value = "收煤数量")
    @Excel(name = "收煤数量")
    private String receiveAmount;

    /** 户收煤时间 */
    @ExcelProperty(value = "收煤时间")
    @Excel(name = "收煤时间")
    @DateTimeFormat("yyyy.mm.dd")
    private String takeinTime;

    @ExcelProperty(value = "收煤人")
    @Excel(name = "收煤人")
    private String receiver;

    @ExcelIgnore
    private Integer status;

    public ClientUserOrderTable(){

    }

    public ClientUserOrderTable(ClientUserOrder order){
        this.amount = order.getAmount() == null ? "" : order.getAmount().stripTrailingZeros().toPlainString();
        this.createTime = order.getCreateTime() == null ? "" : DateUtils.parseDateToStr("yyyy-MM-dd",order.getCreateTime());
        this.takeinTime = order.getTakeinTime() == null ? "" : DateUtils.parseDateToStr("yyyy-MM-dd",order.getTakeinTime());
        this.id = order.getId();
        this.masterName = order.getClientUser().getMasterName();
        this.masterIdentityCardNumber = order.getClientUser().getMasterIdentityCardNumber();
        this.masterPhoneNumber = order.getClientUser().getMasterPhoneNumber();
        this.status = order.getStatus();
        this.money = order.getMoney() == null ? "" : order.getMoney().stripTrailingZeros().toPlainString();
        if(order.getUserReceive() != null){
            UserReceive receive = order.getUserReceive();
            this.receiveAmount = receive.getReceiveNum() == null ? "" : receive.getReceiveNum().toPlainString();
            this.receiver = receive.getReceiveName();
        }
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getMasterName() {
        return masterName;
    }

    public void setMasterName(String masterName) {
        this.masterName = masterName;
    }

    public String getMasterPhoneNumber() {
        return masterPhoneNumber;
    }

    public void setMasterPhoneNumber(String masterPhoneNumber) {
        this.masterPhoneNumber = masterPhoneNumber;
    }

    public String getMasterIdentityCardNumber() {
        return masterIdentityCardNumber;
    }

    public void setMasterIdentityCardNumber(String masterIdentityCardNumber) {
        this.masterIdentityCardNumber = masterIdentityCardNumber;
    }


    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getAmount() {
        return amount;
    }

    public void setAmount(String amount) {
        this.amount = amount;
    }

    public String getMoney() {
        return money;
    }

    public void setMoney(String money) {
        this.money = money;
    }

    public String getReceiveAmount() {
        return receiveAmount;
    }

    public void setReceiveAmount(String receiveAmount) {
        this.receiveAmount = receiveAmount;
    }

    public String getTakeinTime() {
        return takeinTime;
    }

    public void setTakeinTime(String takeinTime) {
        this.takeinTime = takeinTime;
    }

    public String getReceiver() {
        return receiver;
    }

    public void setReceiver(String receiver) {
        this.receiver = receiver;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }
}
